import { filePost, request } from "@/utils/http.js";

import globalConfig from "@/utils/config.js";

const baseUrl = globalConfig.microUrl;
const apiUrl = globalConfig.baseUrl;

export default {
  // 加入购物车
  calculatePrice: (data) => {
    return request({
      url: `${baseUrl}/gd/goods/calculatePrice`,
      method: "POST",
      data
    });
  },
  // 加入购物车
  addCar: (data) => {
    return request({ url: `${baseUrl}/cart/add`, method: "POST", data });
  },
  // 订单确认-获取订单信息
  calculateOrder: (data) => {
    return request({
      url: `${baseUrl}/order/calculateOrder`,
      method: "POST",
      data
    });
  },
  // 订单确认-获取可用积分
  getPointsAvailable: (data) => {
    return request({
      url: `${baseUrl}/order/getPointsAvailable`,
      method: "POST",
      data
    });
  },
  // 地址列表
  addressList: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/page`,
      method: "GET",
      data
    });
    // return request({url: baseUrl + '/member/customerAddress/listAll', method: "GET", data: data})
  },
  // 客户地址-详情
  addressGet: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/get`,
      method: "GET",
      data
    });
  },
  // 保存地址
  addressSave: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/save`,
      method: "POST",
      data
    });
  },
  // 物流-设为默认
  addressDefault: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/setDefault`,
      method: "POST",
      data
    });
  },
  // 物流-删除
  addressDel: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/delete`,
      method: "POST",
      data
    });
  },
  // 购物车列表
  cartList: (data) => {
    return request({ url: `${baseUrl}/cart/list`, method: "GET", data });
  },
  // 删除购物车-商品
  delCart: (data) => {
    return request({
      url: `${baseUrl}/cart/delete`,
      method: "POST",
      data
    });
  },
  // 自提人列表
  customerList: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/listAll`,
      method: "GET",
      data
    });
  },
  // 自提人新增、自提
  customerAdd: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/save`,
      method: "POST",
      data
    });
  },
  // 自提人删除
  customerDel: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/delete`,
      method: "POST",
      data
    });
  },
  // 自提人设为默认
  customerDefault: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/setDefault`,
      method: "POST",
      data
    });
  },
  // 查询库存
  getSkuStock: (data) => {
    return request({
      url: `${baseUrl}/gd/goods/getSkuStock`,
      method: "GET",
      data
    });
  },
  // 立即购买-返回资质
  getNeededSaleQual: (data) => {
    return request({
      url: `${baseUrl}/orderQual/getNeededSaleQual`,
      method: "POST",
      data
    });
  },
  // 订单确认-获取订单信息
  createOrder: (data) => {
    return request({
      url: `${baseUrl}/order/createOrder`,
      method: "POST",
      data
    });
  },
  // 查询资质
  getInfo: (data) => {
    return request({
      url: `${baseUrl}/customer/authorizedPersonApply/getCheckInfo`,
      method: "GET",
      data
    });
  },
  // 计价
  getPrice: (data) => {
    return request({
      url: `${baseUrl}/order/calculateOrder`,
      method: "POST",
      data
    });
  },
  // 判断账期是否能用
  payment: (data) => {
    return request({
      url: `${baseUrl}/member/isPaymentByCredit`,
      method: "GET",
      data
    });
  },
  // 判断是否超期超额
  queryCreditPeriod: (data) => {
    return request({
      url: `${baseUrl}/order/queryCreditPeriod`,
      method: "POST",
      data
    });
  },
  // 立即购买、加入购物车 查询所需企业资质
  getNeededNonSaleQual: (data) => {
    return request({
      url: `${baseUrl}/orderQual/getNeededNonSaleQual`,
      method: "POST",
      data
    });
  },
  // 对客户合同时效性的控制
  judgeHavaUnConfirmContract: (data) => {
    return request({
      url: `${baseUrl}/orderContract/getContractVerification`,
      method: "POST",
      data
    });
  },
  // 线上支付
  payOnline: (data) => {
    return request({
      url: `${baseUrl}/orderPay/yqPay`,
      method: "POST",
      data
    });
  },
  // 可使用积分
  getPoint: (data) => {
    return request({
      url: `${baseUrl}/member/point/get`,
      method: "GET",
      data
    });
  },
  uploadOverdueApplyUrl: (data) => {
    return filePost({
      url: `${apiUrl}/sa/sale/uploadOverdueApplyUrl`,
      filePath: data
    });
  },
  getPayTypePic: (data) => {
    return request({
      url: `${baseUrl}/sa/sale/getPayTypePic`,
      method: "GET",
      data
    });
  },
  // 订单确认-根据店铺id获取支付方式
  listPaymentType: (data) => {
    return request({
      url: `${baseUrl}/paymentType/listPaymentType`,
      method: "GET",
      data
    });
  },
  // 收银台-根据支付方式和店铺id查询支付渠道
  listPaymentChannelType: (data) => {
    return request({
      url: `${baseUrl}/paymentChannelType/listPaymentChannelType`,
      method: "GET",
      data
    });
  },
  // 收银台-获取订单信息
  getOrderSettlementInformation: (data) => {
    return request({
      url: `${baseUrl}/orderPay/getOrderSettlementInformation`,
      method: "GET",
      data
    });
  },
  // 收银台-获取订单信息
  uploadPayFile: (data) => {
    return filePost({
      url: `${baseUrl}/orderPay/uploadPayFile`,
      filePath: data
    });
    // return request({ url: baseUrl + "/orderPay/uploadPayFile", method: "POST", data: data });
  },
  // 获取微信支付参数
  wxJsApiPay: (data) => {
    return request({
      url: `${baseUrl}/orderPay/wxJsApiPay`,
      method: "POST",
      data
    });
  },

  // 订单-配送方式
  getDeliverType: (data) => {
    return request({
      url: `${baseUrl}/store/getDeliverType`,
      method: "GET",
      data
    });
  },

  // 确认订单页-地址列表 增删改查
  customerAddressList: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/listAll`,
      method: "GET",
      data
    });
  },
  customerAddressSave: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/save`,
      method: "POST",
      data
    });
  },
  customerAddressDelete: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/delete`,
      method: "POST",
      data
    });
  },
  customerAddressGet: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/get`,
      method: "GET",
      data
    });
  },
  customerAddressSetDefault: (data) => {
    return request({
      url: `${baseUrl}/customer/customerAddress/setDefault`,
      method: "POST",
      data
    });
  },

  // 确认订单页-自提联系人列表 增删改查
  customerContactList: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/listAll`,
      method: "GET",
      data
    });
  },
  customerContactSave: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/save`,
      method: "POST",
      data
    });
  },
  customerContactDelete: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/delete`,
      method: "POST",
      data
    });
  },
  customerContactGet: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/get`,
      method: "GET",
      data
    });
  },
  customerContactSetDefault: (data) => {
    return request({
      url: `${baseUrl}/customer/customerContact/setDefault`,
      method: "POST",
      data
    });
  },

  getUsableCouponList: (data) => {
    return request({
      url: `${baseUrl}/market/coupon/getUsableCouponList`,
      method: "POST",
      data
    }); // 确认订单页-优惠券列表
  },

  getStoreAccounts: (data) => {
    return request({
      url: `${baseUrl}/store/getStoreAccounts`,
      method: "POST",
      data
    }); // 收银台-获取店铺银行卡信息
  },
  addOrderPay: (data) => {
    return request({
      url: `${baseUrl}/orderPay/addOrderPay`,
      method: "POST",
      data
    }); // 收银台-支付
  },
  saveOrderPay: (data) => {
    return request({
      url: `${baseUrl}/orderPay/saveOrderPay`,
      method: "POST",
      data
    }); // 收银台-修改支付凭证
  },
  getPayResult: (data) => {
    return request({
      url: `${baseUrl}/payChannel/getPayResult`,
      method: "GET",
      data
    }); // 收银台-获取微信支付状态
  },
  // 上传订单合同
  uploadContract: (data) => {
    return filePost({
      url: `${baseUrl}/orderContract/uploadContractUrl`,
      filePath: data
    });
  },

  // saveContract: data => {
  //   return request({ url: baseUrl + "/orderContract/saveContract", method: "POST", data: data }); // 收银台 --签署合同
  // },
  orderPage: (data) => {
    return request({ url: `${baseUrl}/order/page`, method: "GET", data }); // 获取订单列表
  },
  getOrderDetail: (data) => {
    return request({ url: `${baseUrl}/order/get`, method: "GET", data }); // 获取订单详情
  },
  getOrderCount: (data) => {
    return request({
      url: `${baseUrl}/order/pageCount`,
      method: "GET",
      data
    }); // 获取订单数量
  },
  sampleListCount: (data) => {
    return request({
      url: `${baseUrl}/sale/listCount`,
      method: "GET",
      data
    }); // 获取样品订单数量
  },

  saveContract: (data) => {
    return request({
      url: `${baseUrl}/orderContract/saveContract`,
      method: "POST",
      data
    }); // 保存订单合同
  },
  orderProgress: (data) => {
    return request({
      url: `${baseUrl}/order/getSaleProgress`,
      method: "GET",
      data
    }); // 获取订单进度
  },
  remainTime: (data) => {
    return request({
      url: `${baseUrl}/orderPay/salePayRemainTime`,
      method: "GET",
      data
    }); // 获取时间
  },

  orderPageCount: (data) => {
    return request({
      url: `${baseUrl}/order/pageCount`,
      method: "GET",
      data
    }); // 订单列表统计
  },

  // 有料宝收银台-获取支付渠道
  rightsPaymentChannel: (data) => {
    return request({
      url: `${baseUrl}/paymentChannelType/rightsPaymentChannel`,
      method: "GET",
      data
    });
  },
  // 有料宝订单列表
  rightsPage: (data) => {
    return request({
      url: `${baseUrl}/ri/rightsOrder/page`,
      method: "GET",
      data
    });
  },
  // 有料宝订单列表数量查询
  findCountByStatus: (data) => {
    return request({
      url: `${baseUrl}/ri/rightsOrder/findCountByStatus`,
      method: "GET",
      data
    });
  },
  // 有料宝订单详情
  rightsOrderGet: (data) => {
    return request({
      url: `${baseUrl}/ri/rightsOrder/get`,
      method: "GET",
      data
    });
  },
  // 有料宝权益详情 rights/get
  rightsGet: (data) => {
    return request({
      url: `${baseUrl}/ri/rights/get`,
      method: "GET",
      data
    });
  },
  // 有料宝取消订单
  cancelRightsOrder: (data) => {
    return request({
      url: `${baseUrl}/ri/rightsOrder/cancelOrder`,
      method: "POST",
      data
    });
  },
  // 是否有料宝会员判断
  isBuyRights: (data) => {
    return request({
      url: `${baseUrl}/ri/configRightLogo/isBuyRights`,
      method: "GET",
      data
    });
  },
  // 订单推送弹窗
  getPushOrderPopup: (data) => {
    return request({
      url: `${baseUrl}/window/popUpWindow`,
      method: "GET",
      data
    });
  },
  // 通过扫码的订单详情
  getOrderDetailByQRCode: (data) => {
    return request({
      url: `${baseUrl}/order/getV2`,
      method: "GET",
      data
    });
  },
  // 撤回支付
  dealOrderRollBack: (data) => {
    return request({
      url: `${baseUrl}/order/dealOrderRollBack`,
      method: "POST",
      data
    });
  }
};
